﻿/*
----------------------------------------------
    Rodeo Game Engine
    
    Rodeo Core Module
    EventManager.h - header file

    Copyright(c) Marcin Goryca
----------------------------------------------
*/
#ifndef RODEO_CORE_EVENTMANAGER_H_
#define RODEO_CORE_EVENTMANAGER_H_

#ifndef RODEO_CORE_CONSTANTS_H_
#include "core\constants.h"
#endif    //RODEO_CORE_CONSTANTS_H_

#ifndef RODEO_CORE_SINGLETON_H_
#include "core\singleton.h"
#endif    //RODEO_CORE_SINGLETON_H_

#ifndef RODEO_CORE_MASTERMANAGER_H_
#include "core\mastermanager.h"
#endif    //RODEO_CORE_MASTERMANAGER_H_

namespace rodeoevent 
{
class Event;
}

namespace rodeocore
{
class EventManager : public Singleton<EventManager>, public MasterManager
{
public:
    EventManager()
    {
        init();
    }

    virtual ~EventManager()
    {
        clear();
    }

    void translate(rodeoevent::Event* event);

    void dispatch(rodeoevent::Event* event);

    void send(rodeoevent::Event* event);

    virtual void addEventListener(rodeoevent::Event* event_type);

    void removeEventListener();

    // Overload this method in game class
    virtual void getUserInput();

    // Gets Event object pointer
    rodeoevent::Event* getEvent() const
    {
        return event_;
    }

private:

    bool init();

    void clear();

//==== MEMBERS ====//
    rodeoevent::Event* event_;
};
}    //end of rodeocore namespace

#endif    //RODEO_CORE_EVENTMANAGER_H_